Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

list comprehension fails, while map works

#15

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"]]},

Reported by Philipp Pirozhkov · December 24th, 2008 @ 02:39 PM

State: resolved
Milestone: none
Assigned to: Tony Arcieri Tony Arcieri

Activity

  1. Philipp Pirozhkov
    Philipp Pirozhkov

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

    December 24th, 2008 @ 02:41 PM

  2. Tony Arcieri
    Tony Arcieri
    • 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

    December 24th, 2008 @ 10:00 PM

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.