#15 ✓resolved
Philipp Pirozhkov

list comprehension fails, while map works

Reported by Philipp Pirozhkov | 2008-12-24 14:39:30 UTC

I'm calling erlang function, that calls reia back in the follwing way:


A = ["app","aaa","qqq"],
'Reia_module':f(A),

Reia_module:


module Reia_module
  def f(a)

# this works fine:
    b = a.map { |x| x.to_string() } # convert each element to string, since that's a list of lists

# this one fails:
    c = [x.to_string() | x in a]

The exception is:


Reason: {function_clause,[{reia_list,to_erl,[["app","aaa","qqq"]]},

Comments and changes to this ticket

  • Philipp Pirozhkov

    Philipp Pirozhkov 2008-12-24 14:41:10 UTC

    i prefer list comprehension syntax, it's far more compact when it comes to filtering, and it allows for multiple variables

  • Tony Arcieri

    Tony Arcieri 2008-12-24 22:00:09 UTC

    • State changed from “new” to “resolved”

    You're not properly transforming the function arguments when calling the Reia function.

    Try using reia:apply

    Reopen this ticket if it doesn't solve the problem

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Reia a dynamic scripting language for the Erlang virtual machine (BEAM)

People watching this ticket

Tags

Pages